<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8">
    
    <title>Matrix library (numpy.matlib) &mdash; NumPy v1.18 Manual</title>
    
    <link rel="stylesheet" type="text/css" href="../_static/css/spc-bootstrap.css">
    <link rel="stylesheet" type="text/css" href="../_static/css/spc-extend.css">
    <link rel="stylesheet" href="../_static/scipy.css" type="text/css" >
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" >
    <link rel="stylesheet" href="../_static/graphviz.css" type="text/css" >
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.18.1',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  false
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/language_data.js"></script>
    <script type="text/javascript" src="../_static/js/copybutton.js"></script>
    <link rel="author" title="About these documents" href="../about.html" >
    <link rel="index" title="Index" href="../genindex.html" >
    <link rel="search" title="Search" href="../search.html" >
    <link rel="top" title="NumPy v1.18 Manual" href="../index.html" >
    <link rel="up" title="Routines" href="routines.html" >
    <link rel="next" title="numpy.matlib.empty" href="generated/numpy.matlib.empty.html" >
    <link rel="prev" title="numpy.interp" href="generated/numpy.interp.html" > 
  </head>
  <body>
<div class="container">
  <div class="top-scipy-org-logo-header" style="background-color: #a2bae8;">
    <a href="../index.html">
      <img border=0 alt="NumPy" src="../_static/numpy_logo.png"></a>
    </div>
  </div>
</div>


    <div class="container">
      <div class="main">
        
	<div class="row-fluid">
	  <div class="span12">
	    <div class="spc-navbar">
              
    <ul class="nav nav-pills pull-left">
        <li class="active"><a href="https://numpy.org/">NumPy.org</a></li>
        <li class="active"><a href="https://numpy.org/doc">Docs</a></li>
        
        <li class="active"><a href="../index.html">NumPy v1.18 Manual</a></li>
        

          <li class="active"><a href="index.html" >NumPy Reference</a></li>
          <li class="active"><a href="routines.html" accesskey="U">Routines</a></li> 
    </ul>
              
              
    <ul class="nav nav-pills pull-right">
      <li class="active">
        <a href="../genindex.html" title="General Index"
           accesskey="I">index</a>
      </li>
      <li class="active">
        <a href="generated/numpy.matlib.empty.html" title="numpy.matlib.empty"
           accesskey="N">next</a>
      </li>
      <li class="active">
        <a href="generated/numpy.interp.html" title="numpy.interp"
           accesskey="P">previous</a>
      </li>
    </ul>
              
	    </div>
	  </div>
	</div>
        

	<div class="row-fluid">
      <div class="spc-rightsidebar span3">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="generated/numpy.interp.html"
                        title="previous chapter">numpy.interp</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="generated/numpy.matlib.empty.html"
                        title="next chapter">numpy.matlib.empty</a></p>
<div id="searchbox" style="display: none" role="search">
  <h4>Quick search</h4>
    <div>
    <form class="search" action="../search.html" method="get">
      <input type="text" style="width: inherit;" name="q" />
      <input type="submit" value="search" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
          <div class="span9">
            
        <div class="bodywrapper">
          <div class="body" id="spc-section-body">
            
  <span class="target" id="module-numpy.matlib"></span><div class="section" id="matrix-library-numpy-matlib">
<h1>Matrix library (<a class="reference internal" href="#module-numpy.matlib" title="numpy.matlib"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy.matlib</span></code></a>)<a class="headerlink" href="#matrix-library-numpy-matlib" title="Permalink to this headline">¶</a></h1>
<p>This module contains all functions in the <a class="reference internal" href="index.html#module-numpy" title="numpy"><code class="xref py py-mod docutils literal notranslate"><span class="pre">numpy</span></code></a> namespace, with
the following replacement functions that return <a class="reference internal" href="generated/numpy.matrix.html#numpy.matrix" title="numpy.matrix"><code class="xref py py-class docutils literal notranslate"><span class="pre">matrices</span></code></a> instead of <a class="reference internal" href="generated/numpy.ndarray.html#numpy.ndarray" title="numpy.ndarray"><code class="xref py py-class docutils literal notranslate"><span class="pre">ndarrays</span></code></a>.</p>
<p>Functions that are also in the numpy namespace and return matrices</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.mat.html#numpy.mat" title="numpy.mat"><code class="xref py py-obj docutils literal notranslate"><span class="pre">mat</span></code></a>(data[, dtype])</p></td>
<td><p>Interpret the input as a matrix.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.matrix.html#numpy.matrix" title="numpy.matrix"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matrix</span></code></a>(data[, dtype, copy])</p></td>
<td><p><div class="admonition note">
<p class="admonition-title">Note</p>
<p>It is no longer recommended to use this class, even for linear</p>
</div>
</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.asmatrix.html#numpy.asmatrix" title="numpy.asmatrix"><code class="xref py py-obj docutils literal notranslate"><span class="pre">asmatrix</span></code></a>(data[, dtype])</p></td>
<td><p>Interpret the input as a matrix.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.bmat.html#numpy.bmat" title="numpy.bmat"><code class="xref py py-obj docutils literal notranslate"><span class="pre">bmat</span></code></a>(obj[, ldict, gdict])</p></td>
<td><p>Build a matrix object from a string, nested sequence, or array.</p></td>
</tr>
</tbody>
</table>
<p>Replacement functions in <a class="reference internal" href="#module-numpy.matlib" title="numpy.matlib"><code class="xref py py-obj docutils literal notranslate"><span class="pre">matlib</span></code></a></p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.matlib.empty.html#numpy.matlib.empty" title="numpy.matlib.empty"><code class="xref py py-obj docutils literal notranslate"><span class="pre">empty</span></code></a>(shape[, dtype, order])</p></td>
<td><p>Return a new matrix of given shape and type, without initializing entries.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.matlib.zeros.html#numpy.matlib.zeros" title="numpy.matlib.zeros"><code class="xref py py-obj docutils literal notranslate"><span class="pre">zeros</span></code></a>(shape[, dtype, order])</p></td>
<td><p>Return a matrix of given shape and type, filled with zeros.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.matlib.ones.html#numpy.matlib.ones" title="numpy.matlib.ones"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ones</span></code></a>(shape[, dtype, order])</p></td>
<td><p>Matrix of ones.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.matlib.eye.html#numpy.matlib.eye" title="numpy.matlib.eye"><code class="xref py py-obj docutils literal notranslate"><span class="pre">eye</span></code></a>(n[, M, k, dtype, order])</p></td>
<td><p>Return a matrix with ones on the diagonal and zeros elsewhere.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.matlib.identity.html#numpy.matlib.identity" title="numpy.matlib.identity"><code class="xref py py-obj docutils literal notranslate"><span class="pre">identity</span></code></a>(n[, dtype])</p></td>
<td><p>Returns the square identity matrix of given size.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.matlib.repmat.html#numpy.matlib.repmat" title="numpy.matlib.repmat"><code class="xref py py-obj docutils literal notranslate"><span class="pre">repmat</span></code></a>(a, m, n)</p></td>
<td><p>Repeat a 0-D to 2-D array or matrix MxN times.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="generated/numpy.matlib.rand.html#numpy.matlib.rand" title="numpy.matlib.rand"><code class="xref py py-obj docutils literal notranslate"><span class="pre">rand</span></code></a>(\*args)</p></td>
<td><p>Return a matrix of random values with given shape.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="generated/numpy.matlib.randn.html#numpy.matlib.randn" title="numpy.matlib.randn"><code class="xref py py-obj docutils literal notranslate"><span class="pre">randn</span></code></a>(\*args)</p></td>
<td><p>Return a random matrix with data from the “standard normal” distribution.</p></td>
</tr>
</tbody>
</table>
</div>


          </div>
        </div>
          </div>
        </div>
      </div>
    </div>

    <div class="container container-navbar-bottom">
      <div class="spc-navbar">
        
      </div>
    </div>
    <div class="container">
    <div class="footer">
    <div class="row-fluid">
    <ul class="inline pull-left">
      <li>
        &copy; Copyright 2008-2019, The SciPy community.
      </li>
      <li>
      Last updated on Feb 20, 2020.
      </li>
      <li>
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 2.4.2.
      </li>
    </ul>
    </div>
    </div>
    </div>
  </body>
</html>